<?php
$nb_ready_files   = count($ready_files);
$nb_unready_files = count($unready_files);
echo(XML_PROLOG.EOL);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>
      MyChoonz - import
    </title>
    <script type="text/javascript">
    </script>
    <link id="screenStyles" href="app/skin/<?php echo($_SESSION['MczSession']->getSkin());?>/screen.css" type="text/css" rel="stylesheet" media="print, projection, screen" />
  </head>
  <body style="direction: ltr;">
  <div id="help"></div>
  <?php
    if(!empty($errors))
    {
      echo('<p>'.ucfirst(STR_ERR_IMPORT_ERRORS).'</p><ul>');
      foreach($errors as $error)
      {
        echo('<li>'.$error.'</li>');
      }
      echo('</ul>');
    }
    if($nb_unready_files)
    {
      echo('<p>('.ucfirst(STR_UI_FILES_LOADING).$nb_unready_files.')</p>');
    }
    if($nb_ready_files>0)
    {
      echo('<fieldset>
                <legend>'.ucfirst(STR_UI_FILES_WAITING).$nb_ready_files.'</legend>
                <form method="post" action="?c=import" name="importAll">
                <input type="hidden" name="token" value="'.$_SESSION['MczSession']->getToken().'"/>
                <input type="hidden" name="importEmAll" value="now"/>
                <input type="submit" value="'.STR_UI_IMPORT.'"/>
                </form>
                <form method="post" action="?c=import" name="deleteAll" onsubmit="return confirm(\''.ucfirst(STR_UI_ARE_YOU_SURE).'\');">
                <input type="hidden" name="token" value="'.$_SESSION['MczSession']->getToken().'"/>
                <input type="hidden" name="delEmAll" value="now"/>
                <input type="submit" value="'.STR_UI_DELETE.'"/>
                </form>
              </fieldset>');
    }
  ?>
  <form method="post" action="?c=import" enctype="multipart/form-data" name="localImport">
  <fieldset>
  <legend><?php echo(ucfirst(STR_UI_ADD_SONG_LOCAL));?></legend>
  <input type="file" name="songUpload"/>&nbsp;<input type="submit"/>
  <input type="hidden" name="token" value="<?php echo($_SESSION['MczSession']->getToken());?>"/>
  </fieldset>
  </form>
  <form method="post" action="?c=import" name="distantImport">
  <fieldset>
  <legend><?php echo(ucfirst(STR_UI_ADD_SONG_DISTANT));?></legend>
  <input type="text" name="addUrl"/>&nbsp;<input type="submit"/>
  <input type="hidden" name="token" value="<?php echo($_SESSION['MczSession']->getToken());?>"/>
  </fieldset>
  </form>
  <?php
  //Tools::debugInfos();
  ?>
  </body>
</html>
